public class Solution {
    public int findMin(int[] nums) {
        int left = 0,right = nums.length - 1;
        int x = nums[right];
        while(left < right) {
            int mid = left + (right - left) / 2;
            if(nums[mid] > x)   left = mid +1;
            else right = mid;
        }
        return nums[right];
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] nums = {4,5,6,7,0,1,2};
        System.out.println(solution.findMin());
    }
}
